package cn.edu.sziit.bbs.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class LoginInterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截有 "/cch" 前缀的路径，除了 "/cch/login","/cch/dologin"
//        registry.addInterceptor(new LoginInterceptor()).excludePathPatterns("/login","/register","/static/**",
//                "/captcha","/index").addPathPatterns("/**");
        registry.addInterceptor(new LoginInterceptor()).excludePathPatterns("/login", "/register", "/static" +
                "/**", "/captcha", "/index", "/content").addPathPatterns("/**");
        registry.addInterceptor(new AdminLoginInterceptor()).addPathPatterns("/admin/**");
    }
}
